package com.emokili.ewa.sso.service.impl;


import com.emokili.ewa.common.vo.MemberLoginVo;
import com.emokili.ewa.core.frame.entity.MemberEntity;
import com.emokili.ewa.core.frame.service.MemberService;
import com.emokili.ewa.sso.core.model.UserInfo;
import com.emokili.ewa.sso.core.result.ReturnT;
import com.emokili.ewa.sso.service.UserService;
import com.emokili.ewa.sso.user.XxlSsoUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private MemberService memberService;

    @Override
    public ReturnT<MemberEntity> findUser(String username, String password) {

        if (username==null || username.trim().length()==0) {
            return new ReturnT<MemberEntity>(ReturnT.FAIL_CODE, "Please input username.");
        }
        if (password==null || password.trim().length()==0) {
            return new ReturnT<MemberEntity>(ReturnT.FAIL_CODE, "Please input password.");
        }
        MemberLoginVo memberLoginVo = new MemberLoginVo();
        memberLoginVo.setEmail(username);
        memberLoginVo.setPassword(password);
        MemberEntity login = memberService.login(memberLoginVo);

        return new ReturnT<MemberEntity>(login);
    }

    @Override
    public void registerUser(XxlSsoUser xxlSsoUser) {

    }


}
